import calendar_display
import event_manager
import storage_manager

def display_main_menu():
    print("\n欢迎使用校园活动日历")
    print("1. 查看指定月份日历")
    print("2. 添加新事件")
    print("3. 查看特定日期事件")
    print("4. 查看本周/未来N天事件")
    print("5. 删除事件")
    print("6. 退出程序")

def main_loop():
    storage_manager.load_all_events_from_file()
    while True:
        display_main_menu()
        choice = input("请输入选项数字：")
        if choice == "1":
            calendar_display.display_month_calendar_interaction()
        elif choice == "2":
            new_event = event_manager.add_new_event_interaction()
            if new_event:
                storage_manager.save_event_to_file(new_event)
        elif choice == "3":
            event_manager.view_events_for_specific_date_interaction()
        elif choice == "4":
            event_manager.view_upcoming_events_interaction()
        elif choice == "5":
            updated_events = event_manager.delete_event_interaction()
            storage_manager.save_all_events_to_file(updated_events)
        elif choice == "6":
            print("退出程序，再见！")
            break
        else:
            print("无效的选项，请重新输入！")

if __name__ == "__main__":
    main_loop()